﻿using System;

namespace WillsLLC.DbGen.Text.Inflection
{
    [Serializable]
    internal struct IrregularPlural
    {        
        public IrregularPlural(String data)
            : this(data.Split(new Char[] { ' ' }, StringSplitOptions.None)) { }

        public IrregularPlural(String[] data)
        {
            _singular = data[0];
            _pluralAnglicized = data[1];
            _pluralClassical = data[2];
        }
        private String _singular;
        private String _pluralAnglicized;
        private String _pluralClassical;

        internal String Singular { get { return _singular; } }
        internal String PluralAnglicized { get { return _pluralAnglicized; } }
        internal String PluralClassical { get { return _pluralClassical; } }

        public String GetPlural(String singular, Boolean classicalMode)
        {
            if (InflectionUtility.GetWordPattern(this._singular).IsMatch(singular))
            {
                return classicalMode ? this._pluralClassical : this._pluralAnglicized;
            }
            else return null;
        }
    }
}
